package com.star.file.config;

import io.minio.MinioClient;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Minio 配置信息
 *
 * @author zhouhengzhe #公众号：小白的Java进阶之路
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "minio")
public class MinioConfig {

    @ApiModelProperty("服务地址")
    private String url;

    @ApiModelProperty("用户名")
    private String accessKey;

    @ApiModelProperty("密码")
    private String secretKey;

    @ApiModelProperty("存储桶名称")
    private String bucketName;

    @Bean
    public MinioClient getMinioClient() {
        return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
    }
}
